// ==================================================================================
// Shared Genomics Project MPI Codebase
// Version 1.0 30/04/2010
//
// (c) 2010 University of Manchester all rights reserved
//
// This file is distributed under the GNU General Public License, Version 2.  
// Please see the file COPYING.txt for more details
// ==================================================================================

#ifndef _SMALL_INT2_H_
#define _SMALL_INT2_H_

#include "options.h"

#ifdef __cplusplus
extern "C" {
#endif

/*!
\file
\ingroup	gio
\brief		SNP 2-way interaction (Small Structure) 
\details
	Reduced number of bound data fields, used to capture the entire epistasis data-set
	but has not the bound counter variables associated with the other \ref INT2 data-type.
\sa _int2.h
*/

/*!
\brief	Structure representing a 2-way interaction between 2 SNPs
\details Data-type primarily used by the epistasis codes. */
struct small_int2 {
  /*! \brief Array index of the 1st SNP in the interation.  */  
  int p1;

  /*! \brief Array index of the 2nd SNP in the interation.  */  
  int p2;

  double z, coeff;
};

/*! 
\brief Initialises a small_int2 structure.
\details Zeros all bound numeric fields.
\param [in, out] i Pointer to an small_int2 structure
*/
void small_int2_init(struct small_int2 *i);

struct small_int2* small_int2_create_array(int size, BOOL initialise);
void small_int2_echo(struct small_int2 *i2);
int small_int2_write_and_copy(int numprocs, int rank, int nSrc, struct small_int2 *src, struct selected_options *ops);
struct small_int2* small_int2_load(int nSNPs, struct selected_options *ops, int *size, int *nCores);
int small_int2_cmp(const void* p1, const void* p2);
int small_int2_write_interesting_and_copy(struct small_int2 *src, int nSrc, struct selected_options *ops, int rank, BOOL *elements_to_keep);

#ifdef __cplusplus
}
#endif

#endif // _SMALL_INT2_H_
